//
//  PowerHistoryListCell.swift
//  LeGou
//
//  Created by 刘亿前 on 2022/9/14.
//

import UIKit

class PowerHistoryListCell: UITableViewCell {

    // 时间
    @IBOutlet weak var time: UILabel!
    // 状态
    @IBOutlet weak var state: UILabel!
    // 支付金额
    @IBOutlet weak var payMoney: UILabel!
    // 充值金额
    @IBOutlet weak var money: UILabel!
    // 城市
    @IBOutlet weak var address: UILabel!
    // 户号
    @IBOutlet weak var number: UILabel!
    // 返利
    @IBOutlet weak var rebateView: UIView!
    @IBOutlet weak var rebate: UILabel!
    @IBOutlet weak var rebateImg: UIImageView!
    // 退款
    @IBOutlet weak var refund: UILabel!
    
    func setUI(_ info: PowerHistoryModel) {
        time.text = info.createTime
        state.text = info.statusStr
        state.textColor = info.statusInfo["color"]!.zm.hex()
        payMoney.text = "实付金额：\(info.payPrice.zm.toString(keep: 2))元"
        money.text = "充值金额：\(info.facePrice.zm.toString(keep: 2))元"
        address.text = "缴费地区：" + info.province + info.city
        number.text = "缴费户号：" + info.account
        rebateView.isHidden = info.commission == 0
        rebate.text = "\(info.commission)元"
        refund.text = info.refundStatusStr
        if info.refundPrice == info.payPrice {
            rebateImg.image = UIImage(named: "power_7")
        } else {
            rebateImg.image = UIImage(named: "power_6")
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
